<?php

class model_comment extends Model {
    public function  __construct() {
        parent::__construct();
    }

    public function isUserComment($cid) {
        return count($this->db->query("SELECT * FROM #_comment_users_comments WHERE comment_id = '$cid' AND user_id = '".User::getUserId()."'")->rows);
    }

    public function isCommentRecommendedBy($cid) {
        return !!count($this->db->query("SELECT comment_id FROM #_comment_users_comments_like_by_users WHERE comment_id='$cid' AND user_id='".User::getUserId()."'")->rows);
    }

    public function setCommentRecommendedBy($cid) {
        $this->db->query("INSERT INTO #_comment_users_comments_like_by_users SET comment_id = '$cid', user_id='".User::getUserId()."'");
    }
}

?>
